package reflect.hibernate;

/**
 * @author yangwenqi
 * @decs TODO
 * @date 2025/5/28
 * 反射: “暴力破解”
 * 1.破坏封装性
 * 2.破坏泛型
 *
 * 需求：获取对象的所有属性及其值，以 name-张三 ，num-101 ， age=18存入obj.txt文件中
 * 格式如下：
----------Teacher+-----------
name - 王朝
workAge - 10
major - 舞蹈
----------Student+-----------
name - 张三
num - 101
age - 18
 */
public class Teacher {
    private String name;
    private int workAge;
    private String major;

    public Teacher() {
    }

    public Teacher(String name, int workAge, String major) {
        this.name = name;
        this.workAge = workAge;
        this.major = major;
    }

    /**
     * 获取
     * @return name
     */
    public String getName() {
        return name;
    }

    /**
     * 设置
     * @param name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取
     * @return workAge
     */
    public int getWorkAge() {
        return workAge;
    }

    /**
     * 设置
     * @param workAge
     */
    public void setWorkAge(int workAge) {
        this.workAge = workAge;
    }

    /**
     * 获取
     * @return major
     */
    public String getMajor() {
        return major;
    }

    /**
     * 设置
     * @param major
     */
    public void setMajor(String major) {
        this.major = major;
    }

    public String toString() {
        return "Teacher{name = " + name + ", workAge = " + workAge + ", major = " + major + "}";
    }
}
